package com.lenovo.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Descpription 查看所有测试报告功能拦截器
 * @Author CJF
 * @Date 2019/1/17 10:54
 **/
@Component
public class AllReportInterceptor implements HandlerInterceptor {

    /**
     * 所有测试报告的权限码值为 1024
     * 二进制：10000000000（11位）
     */
    private final Integer ALL_REPORT_LEVEL_NUM = 1024;

    @Autowired
    private IfPermission ifPermission;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        return ifPermission.CheckPermission(ALL_REPORT_LEVEL_NUM, request, response);

    }
}
